# -*- coding: utf-8 -*-
"""
Module Description: 全局管理对象
Date: 2017/12/22
Author:Bai Jin Ping
"""
# from pyshare.const.enums.server_info import ServerType


class GlobalObject(object):
    """全局管理对象"""

    # 服务器类型 const/enums/server_info.py::ServerType
    # server_type = ServerType.Area

    # 服务器停止前的清理工作
    stophandler = None
    # wsgi实例对象
    webapp = None
    # 进程监听端口
    webport = 33333
    # 保存service.json的配置
    global_config = {}
    # 服务器运行状态
    running = False
    # 是否正在处理关闭信号
    is_handlering_stop_signal = False

    @classmethod
    def server_start(cls):
        """设置为启动状态"""
        cls.running = True

    @classmethod
    def server_stop(cls):
        """设置为关闭状态"""
        cls.running = False

    # @classmethod
    # def is_area_server(cls):
    #     """是否area服务"""
    #     return cls.server_type == ServerType.Area
    #
    # @classmethod
    # def is_cross_server(cls):
    #     """是否cross服务"""
    #     return cls.server_type == ServerType.Cross
